package utils
{
    import flash.utils.*;

    public class Time
    {
        private var _startTime:Number;
        private var _lastTime:Number;
        private var _nowTime:Number;

        public function Time():void
        {
            _startTime = getTimer();
            _lastTime = _startTime;
            _nowTime = _lastTime;
        }

        public function start():void
        {
            _startTime = getTimer();
            _lastTime = _startTime;
            _nowTime = _lastTime;
        }

        public function interval():Number
        {
            _nowTime = getTimer();
            return _nowTime - _lastTime;
        }

        public function next():void
        {
            _lastTime = _nowTime;
        }

        public function total():Number
        {
            return _nowTime - _startTime;
        }
    }
}
